/**
 * 
 */
package com.mycompany.client;

import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuBar;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.MenuItemSeparator;

/**
 * @author coral.ma
 *
 */
public class MainMenu {

	public MenuBar getMenu() {
		Menu menu = new Menu();
		menu.setTitle("File");
		menu.setWidth(70);
		menu.setShowShadow(true);  
		menu.setShadowDepth(10);  
		MenuItem newItem = new MenuItem("New", "icons/16/document_plain_new.png", "Ctrl+N");  
		MenuItem openItem = new MenuItem("Open", "icons/16/folder_out.png", "Ctrl+O");  
		MenuItem saveItem = new MenuItem("Save", "icons/16/disk_blue.png", "Ctrl+S");  
		MenuItem saveAsItem = new MenuItem("Save As", "icons/16/save_as.png");  
		MenuItem recentDocItem = new MenuItem("Recent Documents", "icons/16/folder_document.png");  

		MenuItem exportItem = new MenuItem("Export as...", "icons/16/export1.png");  
		Menu exportSM = new Menu();  
		exportSM.setItems(  
		        new MenuItem("XML"),  
		        new MenuItem("CSV"),  
		        new MenuItem("Plain text"));  
		exportItem.setSubmenu(exportSM);  

		MenuItem printItem = new MenuItem("Print", "icons/16/printer3.png", "Ctrl+P");  
		printItem.setEnabled(false);  

		MenuItemSeparator separator = new MenuItemSeparator();  

		menu.setItems(newItem, openItem, separator, saveItem, saveAsItem,  
		        separator, recentDocItem, separator, exportItem, separator, printItem);  

		Menu menu2 = new Menu();  
		menu2.setTitle("Edit");
		menu2.setShowShadow(true);  
		menu2.setShadowDepth(10);
		menu2.setWidth(70);
		menu2.setItems(saveItem, saveAsItem, separator, recentDocItem, separator, exportItem, separator, printItem);  
		
		Menu menu3 = new Menu();  
		menu3.setTitle("Help");
		menu3.setWidth(70);
		menu3.setShowShadow(true);  
		menu3.setShadowDepth(10);
		menu3.setItems(exportItem, separator, printItem);
//		IMenuButton menuButton = new IMenuButton("File", menu);  
//		menuButton.setWidth(100);  
		MenuBar menuBar = new MenuBar();
		menuBar.setWidth100();
		menuBar.setSmoothFade(true);
		menuBar.setHoverDelay(1);
		Menu[] menus = new Menu[]{menu,menu2,menu3};
		menuBar.setMenus(menus);
		return menuBar;
	}
}
